﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GalaSoft.MvvmLight.Messaging;
using OneOfAll.Common.Models;

namespace OneOfAll.UserControls
{
    /// <summary>
    /// PeopleInfoControl.xaml 的交互逻辑
    /// </summary>
    public partial class PeopleInfoControl : UserControl
    {
        public PeopleModel Info
        {
            get { return (PeopleModel)GetValue(InfoProperty); }
            set { SetValue(InfoProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Info.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty InfoProperty =
            DependencyProperty.Register("Info", typeof(PeopleModel), typeof(PeopleInfoControl), new PropertyMetadata(null));



        public bool IsSelected
        {
            get { return (bool)GetValue(IsSelectedProperty); }
            set { SetValue(IsSelectedProperty, value); }
        }

        // Using a DependencyProperty as the backing store for IsSelected.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsSelectedProperty =
            DependencyProperty.Register("IsSelected", typeof(bool), typeof(PeopleInfoControl), new PropertyMetadata(false));


        public PeopleInfoControl()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;
            if (button == null) return;
            switch (button.Content.ToString())
            {
                case "详情":
                    Messenger.Default.Send("PeopleInfoView", Global.GlobalResource.ShowChildrenInfo);
                    Messenger.Default.Send(Info, Global.GlobalResource.ShowPeopleInfo);
                    break;
                case "驱逐":
                    break;
            }
        }
    }
}
